package ragserverengine.milvus

import kotlinx.serialization.Serializable

// milvus insert时的数据类
@Serializable
data class MilvusRequest(
    val collectionName: String,        // 集合名称
    val vectors: List<List<Float>>,        // 向量数据
    val docs: List<String>,                   // 原始文本
    val metas: List<String>,  // 元数据
    val ids: List<Long>? = null
)

@Serializable
data class MilvusResponse(
    val collectionName: String,       // 集合名称
    val insertedCount: Long,
    val success: Boolean,             // 操作是否成功
    val message: String? = null,      // 附加信息（错误或提示）
    val ids: List<Long>? = null       // 若 Milvus 生成了自增 ID，可选返回
)

// milvus查询时的数据类
@Serializable
data class MilvusSearchRequest(

    val collectionName: String,
    val vector: List<List<Float>>,
    val topK: Int=5,
    val metricType: String = "L2",
    val outputFields: List<String>? = listOf("id", "doc", "meta")
)

@Serializable
data class MilvusSearchResultItem(
    val id: Long,
    val score: Float,
    val doc: String? = null,
    val meta: String? = null
)

@Serializable
data class MilvusSearchResponse(
    val collectionName: String,
    val results: List<List<MilvusSearchResultItem>>, // 每个查询向量对应一组结果
    val success: Boolean,
    val message: String? = null
)